home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
os2
/
adaptor.zip
/
ADAPT.ZIP
/
adaptor
/
examples
/
fractal
/
mandel.f
< prev
next >
Wrap
Text File
|
1993-06-28
|
3KB
|
95 lines
program mandel
real xmin, xmax, ymin, ymax
integer width, height
integer bild (:,:), hostbild (:,:)
cmf$ layout hostbild (:host)
logical mask (:,:)
logical done
integer hx1, hx2, hy1, hy2
integer maxtiefe
parameter (maxtiefe = 256)
real valmax
parameter (valmax = 40.0)
real xp(:,:), yp(:,:)
real x(:,:), y(:,:), xalt(:,:)
print *, 'Input Width - Height '
print *, 'should always be a multiple of 4 '
read *, width, height
allocate (bild(1:height,1:width))
allocate (hostbild(1:height,1:width))
allocate (mask(1:height,1:width))
allocate (xp(1:height,1:width))
allocate (yp(1:height,1:width))
allocate (x(1:height,1:width))
allocate (y(1:height,1:width))
allocate (xalt(1:height,1:width))
call x_display_init (width, height)
xmin = -2.0
xmax = 1.0
ymin = -1.0
ymax = 1.0
done = .false.
do while (.not. done )
!HPF$ INDEPENDENT, LOCAL_ACCESS
do i=1,height
!HPF$ INDEPENDENT, LOCAL_ACCESS
do j=1,width
xp(i,j) = j
end do
end do
xp = (xmax - xmin) * xp
xp = xp /width + xmin
!HPF$ INDEPENDENT, LOCAL_ACCESS
do j=1,width
!HPF$ INDEPENDENT, LOCAL_ACCESS
do i=1,height
yp(i,j) = i
end do
end do
yp = (ymax - ymin) * yp
yp = yp /height + ymin
c print *, 'xp = ', xp
c print *, 'yp = ', yp
x = 0.0
y = 0.0
bild = 0
DO K=1,MAXTIEFE
mask = ( (X*X+Y*Y) .LT. VALMAX )
WHERE ( mask )
XALT = X
X = (X*X-Y*Y) + XP
Y = (2*XALT*Y) + YP
BILD = BILD + 1
ENDWHERE
END DO
hostbild = bild
call x_show_bild (hostbild,width,height)
call x_new_action (hx1,hx2,hy1,hy2)
if ((hx1 .eq. 0) .or. (hx2 .eq. 0)) then
done = .true.
else
diffx = xmax - xmin
diffy = ymax - ymin
xmax = (diffx * hx2) / (width - 1) + xmin
ymax = (diffy * hy2) / (height - 1) + ymin
xmin = (diffx * hx1) / (width - 1) + xmin
ymin = (diffy * hy1) / (height - 1) + ymin
end if
end do
call x_display_exit ()
deallocate (xalt, y, x, yp, xp)
deallocate (mask, hostbild, bild)
end